<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$site_name}-{$company.name}</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <link rel="stylesheet" type="text/css" href="__TMPL__Qrcode/Public/css/agristyle.css?8664"/>
</head>
<body>
  <div class="agri-wrap">
      <div class="agri-header">中国农药溯源管理系统</div>
      <div id="agri-container">
          <div class="agri-con">
              <div>
                  <span class="badge"></span>
                  <span class="agri-con-font">
                      {$category['xxlb']}
                  </span>
              </div>

              <div class="part-text">
                  <if condition="$category['mr1']">

                      {$category['mr1']}：{$order.depart}<br/>

                  </if>

                  <php>$number=1;</php>
                  <foreach name="trace" item="val">
                      <if condition="$val.identity eq '厂家'">
                          <span style="color:#c1191e;"><php>echo $number;</php>、</span>{$comname[$val['company']]['name']}<br/><neq name="order.typedate" value="0000-00-00">（生产日期：{$order.typedate}）</neq>销往地（{$val.province}{$val.city}{$val.sendtime}）<br/>
                          <php>$number++;</php>
                      </if>
                  </foreach>

                  <foreach name="trace" item="val">
                      <if condition="$val.identity neq '厂家'">
                          <span style="color:#c1191e;"><php>echo $number;</php>、</span></font>{$comname[$val['company']]['name']}<br/>（时间：{$val.createtime}）<br/>
                          <php>$number++;</php>
                      </if>
                  </foreach>

              </div>
              <hr style="height: 1px;border: none;border-top: 1px solid #cccccc;margin: 10px 2px">
              <if condition="$qrcode['scunitcode']">
                  <div>
                      <span class="badge"></span>
                      <span class="agri-con-font">产品单元识别代码</span>
                  </div>
                  <div class="part-text">
                      {$qrcode.scunitcode}
                  </div>
              </if>
          </div>
          <div id="company-name"><h3>{$product.name}</h3></div>
          <div class="agri-con">
              <div>
                  <span class="badge"></span>
                  <span class="agri-con-font">基本信息</span>
              </div>
              <div class="part-text">
                  {$product.description|htmlspecialchars_decode}
              </div>
          </div>
          <if condition="$order.typedate neq '0000-00-00'">
              <div class="clearfix agri-con">
                  <div class="agri-left">
                      <span class="badge"></span>
                      <span class="agri-con-font">生产日期</span>
                  </div>
                  <div class="agri-right">
                      <span class="agri-con-num">{$order.typedate}</span>
                  </div>
              </div>
          </if>


          <?php
		if($order['types'] && $order['typesdate']!='0000-00-00') {
						?>
          <div class="clearfix agri-con">
              <div class="agri-left">
                  <span class="badge"></span>
                  <span class="agri-con-font">{$order.types}</span>
              </div>
              <div class="agri-right">
                  <span class="agri-con-num">
                  <?php
				echo $order['typesdate'];
				if($order['typesdate']!='0000-00-00' &&  strtotime($order['typesdate']) < time() && $order['types'] == '过期日期') {
				    echo '该产品已过期，请勿使用。';
				}?>
              </div>
          </div>
          <?php
          }
            ?>


      <if condition="$category['mr2']">
          <div class="agri-con">
              <div>
                  <span class="badge"></span>
                  <span class="agri-con-font">{$category['mr2']}</span>
              </div>
              <div class="part-text">
                  {$order.tech|htmlspecialchars_decode}
              </div>
          </div>
      </if>

      <if condition="$category['field1']">
          <div class="agri-con">
              <div>
                  <span class="badge"></span>
                  <span class="agri-con-font">{$category['field1']}</span>
              </div>
              <div class="part-text">
                  {$order.field1|htmlspecialchars_decode}
              </div>
          </div>
      </if>

      <if condition="$category['field2']">
          <div class="agri-con">
              <div>
                  <span class="badge"></span>
                  <span class="agri-con-font">{$category['field2']}</span>
              </div>
              <div class="part-text">
                  {$order.field2|htmlspecialchars_decode}
              </div>
          </div>
      </if>

      </div>
  </div>

  <div class="agri-footer"><p>本产品已经扫码查看{$FWCount}次</p><span>本服务由大友印相网络科技公司提供</span></div>

  <!--<div class="potion">-->
      <!--<img src="/sy/themes/simplebootx/Qrcode/Public/images/true_tel.png" usemap="#true_tel">-->
      <!--<map name="true_tel" id="true_tel">-->
          <!--<area shape="rect" coords="0,0,50,50" href="#" onclick="zhenpin();">-->
          <!--<area shape="rect" coords="0,52,100,100" href="tel:{$company.phone}" >-->
      <!--</map>-->
  <!--</div>-->

  <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1271612451'%3E%3C/span%3E%3Cscript  src='" + cnzz_protocol + "s19.cnzz.com/stat.php%3Fid%3D1271612451%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>
  <script charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js?v=<php>echo time();</php>" type="text/javascript"></script>
  <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=f57ed64590e8bbc591180c98516bcd10&plugin=AMap.Geocoder"></script>
  <script type="text/javascript">
      var view_id = $('#qrorder-info').data('view_id');
      if(view_id > 0) {
          wx.config(<?php echo $wechat_js->config(array('getLocation'));?>);
          wx.ready(function(){
              wx.getLocation({
                  type: 'wgs84',
                  success: function (res) {
                      var latitude = res.latitude;
                      var longitude = res.longitude;
                      lnglatXY = [longitude, latitude];
                      var geocoder = new AMap.Geocoder({
                          radius: 1000,
                          extensions: "all"
                      });
                      geocoder.getAddress(lnglatXY, function(status, result) {
                          if (status === 'complete' && result.info === 'OK') {
                              var city = result.regeocode.addressComponent.city;
                              var province = result.regeocode.addressComponent.province;
                              if(city && province) {
                                  $.post("{:leuu('Qrcode/Company/update_view')}",
                                      {view_id:view_id,city:city,province:province,latitude:latitude,longitude:longitude},
                                      function(data){},'json');
                              }
                          }
                      });
                  }
              });
          });
      }
  </script>
</body>
</html>